/*
 * Checker.h
 *
 *  Created on: 4.1.2013
 *      Author: shadius
 */

#ifndef CHECKER_H_
#define CHECKER_H_
#include "INPUT_PARAMS.h"
#include "IFastDataApprox.h"

class Checker {
private:
	INPUT_PARAMS const params;

public:
	bool checkRange(int index, double value) const {
		switch (index) {
		case PI:
			return checkRangeP(value);
			break;
		case CGI:
			return checkRangeCG(value);
			break;
		case CI:
			return checkRangeC(value);
			break;
		case DTI:
			return checkRangeDT(value);
			break;
		default:
			return false;
			break;
		}
	}
	bool checkRangeP(double p) const {
		if (params.isPset) {
			return p == params.p;
		}
		return p > PARAM_P_DEFAULT_MIN && p < PARAM_P_DEFAULT_MAX;

	}
	bool checkRangeCG(double cg) const {

		return cg < 0;

	}
	bool checkRangeDT(double dt) const {
		return dt > params.dtMin && dt < params.dtMax;
	}
	bool checkRangeC(double c) const {
		if (params.isCset) {
			return c == params.c;
		}
		return c > 0;
	}
	//TODO: tady sloučit konstruktory
	Checker(INPUT_PARAMS params);
	bool checkTimeJumpRange(double k, double dt, double ecg) const {
		double jmp = k * dt * ecg;

		return jmp <= 5 * OneMinute && jmp >= -5 * OneMinute;
	}

	virtual ~Checker();

};
#endif /* CHECKER_H_ */
